Lines Matching refs:path

67 	char path[PATH_MAX];
164 static int read_file(const char *path, char *buf, size_t buflen)
169 fd = open(path, O_RDONLY);
185 static int write_file(const char *path, const char *buf, size_t buflen)
190 fd = open(path, O_WRONLY);
192 printf("open(%s)\n", path);
210 char path[PATH_MAX];
215 ret = snprintf(path, PATH_MAX, THP_SYSFS "%s", name);
221 if (!read_file(path, buf, sizeof(buf))) {
222 perror(path);
255 char path[PATH_MAX];
258 ret = snprintf(path, PATH_MAX, THP_SYSFS "%s", name);
264 if (!write_file(path, val, strlen(val) + 1)) {
265 perror(path);
270 static const unsigned long _read_num(const char *path)
274 if (read_file(path, buf, sizeof(buf)) < 0) {
284 char path[PATH_MAX];
287 ret = snprintf(path, PATH_MAX, THP_SYSFS "%s", name);
292 return _read_num(path);
295 static void _write_num(const char *path, unsigned long num)
300 if (!write_file(path, buf, strlen(buf) + 1)) {
301 perror(path);
308 char path[PATH_MAX];
311 ret = snprintf(path, PATH_MAX, THP_SYSFS "%s", name);
316 _write_num(path, num);
429 char path[PATH_MAX];
438 if (snprintf(finfo.path, sizeof(finfo.path), "%s/" TEST_FILE,
439 finfo.dir) >= sizeof(finfo.path)) {
452 if (snprintf(path, sizeof(path), "/sys/dev/block/%d:%d/uevent",
454 >= sizeof(path)) {
458 if (read_file(path, buf, sizeof(buf)) < 0) {
475 printf("%s: Unknown device type: %s\n", __func__, path);
485 printf("%s: Could not read: %s", __func__, path);
504 printf("%s: Could not read: %s\n", __func__, path);
669 unlink(finfo.path); /* Cleanup from previous failed tests */
670 printf("Creating %s for collapse%s...", finfo.path,
672 fd = open(finfo.path, O_DSYNC | O_CREAT | O_RDWR | O_TRUNC | O_EXCL,
687 printf("Opening %s read only for collapse...", finfo.path);
688 finfo.fd = open(finfo.path, O_RDONLY, 777);
710 unlink(finfo.path);
1452 * When testing file-backed memory, the collapse path