search for: st_buf

Displaying 5 results from an estimated 5 matches for "st_buf".

Did you mean: s_buf
2013 Feb 12
10
[PATCH] Btrfs-progs: check out if the swap device
...1386,52 @@ int get_fs_info(int fd, char *path, struct btrfs_ioctl_fs_info_args *fi_args, return 0; } + +/* + * Checks if the swap device or not. + * Returns 1 if the swap device, < 0 on error or 0 if not the swap device. + */ +int is_swap_device(const char *file) +{ + FILE *f; + struct stat st_buf; + char buf[1024]; + char *cp; + dev_t rdev; + int ret = 0; + + if (stat(file, &st_buf) < 0) + return -errno; + if (!S_ISBLK(st_buf.st_mode)) + return 0; + + rdev = st_buf.st_rdev; + + if ((f = fopen("/proc/swaps", "r")) == NULL) + return -errno; + + /* skip the first...
2009 Nov 14
2
[PATCH] btrfs-progs: Check mount status of multidevice filesystems
...ret; } +int is_loop_device (const char *device) { + struct stat statbuf; + + if(stat(device, &statbuf) < 0) + return -errno; + + return (S_ISBLK(statbuf.st_mode) && + major(statbuf.st_rdev) == LOOP_MAJOR); +} + +int is_same_blk_file(const char* a, const char* b) +{ + struct stat st_buf_a, st_buf_b; + char real_a[PATH_MAX]; + char real_b[PATH_MAX]; + + if(!realpath(a, real_a) || + !realpath(b, real_b)) + { + return -errno; + } + + /* Identical path? */ + if(strcmp(real_a, real_b) == 0) + return 1; + + if(stat(a, &st_buf_a) < 0 || + stat(b, &st_buf_b) < 0) + {...
2010 Aug 18
16
[PATCH 00 of 16] libxl: autogenerate type definitions and destructor functions
The series introduces auto-generation of the type definitions used in the libxl interface followed by auto-generation of a destructor function for each type. In the future it may be possible to use the related data structures for other purposes, for example auto-generation of the functions to marshal between C and language binding data types. tools/_libxl_types.h should be identical both before
2012 May 17
8
[PATCH] libxl: do not overwrite user supplied config when running bootloader
...c Thu May 17 16:39:51 2012 +0100 +++ b/tools/libxl/libxl_internal.c Thu May 17 17:51:32 2012 +0100 @@ -216,7 +216,7 @@ char *libxl__abs_path(libxl__gc *gc, con } -int libxl__file_reference_map(libxl_file_reference *f) +int libxl__file_reference_map(libxl__file_reference *f) { struct stat st_buf; int ret, fd; @@ -249,7 +249,7 @@ out: return ret == 0 ? 0 : ERROR_FAIL; } -int libxl__file_reference_unmap(libxl_file_reference *f) +int libxl__file_reference_unmap(libxl__file_reference *f) { int ret; diff -r ac45608496cd -r cdb947baea10 tools/libxl/libxl_internal.h --- a/too...
2010 Aug 12
0
[PATCH, v2]: xl: Implement per-API-call garbage-collection lifetime
...ce_disk *disk, uint32_t domid) { - int ret; - + libxl_gc gc = LIBXL_INIT_GC(ctx); + int ret, rc = 0; char *fifo = NULL; const char *diskpath = NULL; char **args = NULL; @@ -322,49 +322,48 @@ int libxl_run_bootloader(libxl_ctx *ctx, struct stat st_buf; if (info->hvm || !info->u.pv.bootloader) - return 0; + goto out; + rc = ERROR_INVAL; if (!disk) - return ERROR_INVAL; + goto out; + rc = ERROR_FAIL; ret = mkdir("/var/run/libxl/", S_IRWXU); if (ret < 0 && errno...