MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / bsd_name_for_path

Function bsd_name_for_path

test/test.c:5700–5719  ·  view source on GitHub ↗

* bsd_name_for_path * * Returns the BSD device name for the block device that contains the * passed-in path. Returns NULL on failure. ****************************************************************************/

Source from the content-addressed store, hash-verified

5698 * passed-in path. Returns NULL on failure.
5699 ****************************************************************************/
5700static char* bsd_name_for_path(char *path)
5701{
5702 const char *prefix = "/dev/";
5703 struct statfs s;
5704
5705 if (statfs(path, &s) == -1)
5706 {
5707 return NULL;
5708 }
5709
5710 size_t lenpre = strlen(prefix),
5711 lenstr = strlen(s.f_mntfromname);
5712
5713 if (lenstr > lenpre && strncmp(prefix, s.f_mntfromname, lenpre) == 0)
5714 {
5715 return strdup(s.f_mntfromname + lenpre);
5716 }
5717
5718 return strdup(s.f_mntfromname);
5719}
5720
5721/****************************************************************************
5722 * device_is_dvd

Callers 1

ParseOptionsFunction · 0.85

Calls 1

statfsClass · 0.85

Tested by

no test coverage detected