search for: devfd

Displaying 20 results from an estimated 64 matches for "devfd".

Did you mean: devfn
2015 Nov 13
4
[PATCH] extlinux: code cleanup and simplification
...+++++++++++----------------------------- 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/extlinux/main.c b/extlinux/main.c index 6871fb1..a2a396a 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -338,6 +338,59 @@ static int patch_file_and_bootblock(int fd, const char *dir, int devfd) return rv; } +static int ext_read_adv_offset(int devfd, off_t offset) +{ + const size_t adv_size = 2 * ADV_SIZE; + + if (xpread(devfd, syslinux_adv, adv_size, offset) != adv_size) + return -1; + + return syslinux_validate_adv(syslinux_adv) ? 1 : 0; +} + +static int ext_read_a...
2015 Nov 12
1
[PATCH] Unification of ext_(write/read)_adv
...--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/extlinux/main.c b/extlinux/main.c index 6871fb1..385b364 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -1415,21 +1415,12 @@ static int open_device(const char *path, struct stat *st, char **_devname) return devfd; } -static int btrfs_read_adv(int devfd) -{ - if (xpread(devfd, syslinux_adv, 2 * ADV_SIZE, BTRFS_ADV_OFFSET) - != 2 * ADV_SIZE) - return -1; - - return syslinux_validate_adv(syslinux_adv) ? 1 : 0; -} - -static inline int xfs_read_adv(int devfd) +static int ext_read_adv_offset(int devfd, o...
2015 Nov 18
0
[PATCH] extlinux: code cleanup and simplification
...- > 1 file changed, 55 insertions(+), 58 deletions(-) > > diff --git a/extlinux/main.c b/extlinux/main.c > index 6871fb1..a2a396a 100644 > --- a/extlinux/main.c > +++ b/extlinux/main.c > @@ -338,6 +338,59 @@ static int patch_file_and_bootblock(int fd, const char > *dir, int devfd) > return rv; > } > > +static int ext_read_adv_offset(int devfd, off_t offset) > +{ > + const size_t adv_size = 2 * ADV_SIZE; > + > + if (xpread(devfd, syslinux_adv, adv_size, offset) != adv_size) > + return -1; > + > + return syslinux_validate_a...
2015 Nov 26
0
[syslinux:master] extlinux: code cleanup and simplification
...+++++++++++----------------------------- 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/extlinux/main.c b/extlinux/main.c index a715963..a7ebd49 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -338,6 +338,59 @@ static int patch_file_and_bootblock(int fd, const char *dir, int devfd) return rv; } +static int ext_read_adv_offset(int devfd, off_t offset) +{ + const size_t adv_size = 2 * ADV_SIZE; + + if (xpread(devfd, syslinux_adv, adv_size, offset) != adv_size) + return -1; + + return syslinux_validate_adv(syslinux_adv) ? 1 : 0; +} + +static int ext_read_a...
2015 Nov 18
1
[PATCH] extlinux: code cleanup and simplification
...- >? 1 file changed, 55 insertions(+), 58 deletions(-) > > diff --git a/extlinux/main.c b/extlinux/main.c > index 6871fb1..a2a396a 100644 > --- a/extlinux/main.c > +++ b/extlinux/main.c > @@ -338,6 +338,59 @@ static int patch_file_and_bootblock(int fd, const char > *dir, int devfd) >? ? ? return rv; >? } > > +static int ext_read_adv_offset(int devfd, off_t offset) > +{ > +? ? const size_t adv_size = 2 * ADV_SIZE; > + > +? ? if (xpread(devfd, syslinux_adv, adv_size, offset) != adv_size) > +? ? ? return -1; > + > +? ? return syslinux_validate_a...
2014 Dec 24
0
[PATCH 1/8] extlinux/main.c: support unmounted ext2/3/4 filesystem
...e5 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -41,6 +41,7 @@ #include <sys/types.h> #include <sys/mount.h> #include <sys/vfs.h> +#include <ext2fs/ext2fs.h> #include "linuxioctl.h" @@ -991,6 +992,12 @@ static int install_file(const char *path, int devfd, struct stat *rst) return 1; } + +static int install_file_to_device(const char *device_path, int devfd, + int update_only) +{ +} + #ifdef __KLIBC__ static char devname_buf[64]; @@ -1452,15 +1459,26 @@ static int ext_write_adv(const char *path, const char *cfg, int devfd)...
2015 Nov 13
4
[PATCH 1/4] extlinux: simplification
...nuxc32, + syslinux_ldlinuxc32_len, 0); + if (rv != (int)syslinux_ldlinuxc32_len) { + fprintf(stderr, "%s: write failure on %s\n", program, file); + rv = 1; + } else + rv = 0; + + close(fd); + free(file); + + return rv; +} + int ext2_fat_install_file(const char *path, int devfd, struct stat *rst) { - char *file, *oldfile, *c32file; + char *file, *oldfile; int fd = -1, dirfd = -1; - int r1, r2, r3; + int r1, r2; r1 = asprintf(&file, "%s%sldlinux.sys", path, path[0] && path[strlen(path) - 1] == '/' ? "" :...
2015 Sep 10
2
[PATCH v2 1/1] extlinux: fix memory leak
...(devname_buf); } #else @@ -1350,10 +1361,10 @@ static const char *get_devname(const char *path) return devname; } -static int open_device(const char *path, struct stat *st, const char **_devname) +static int open_device(const char *path, struct stat *st, char **_devname) { int devfd; - const char *devname = NULL; + char *devname = NULL; struct statfs sfs; if (st) @@ -1393,11 +1404,10 @@ static int open_device(const char *path, struct stat *st, const char **_devname) devfd = -1; devname = get_devname(path); - if (_devname) - *_devname = devname;...
2015 Sep 09
1
[PATCH v1 1/1] extlinux: fix memory leak
...gram, path); return devname; @@ -1350,10 +1361,10 @@ static const char *get_devname(const char *path) return devname; } -static int open_device(const char *path, struct stat *st, const char **_devname) +static int open_device(const char *path, struct stat *st, char **_devname) { int devfd; - const char *devname = NULL; + char *devname = NULL; struct statfs sfs; if (st) @@ -1393,11 +1404,10 @@ static int open_device(const char *path, struct stat *st, const char **_devname) devfd = -1; devname = get_devname(path); - if (_devname) - *_devname = devname;...
2012 Aug 02
0
[PATCH 1/3] ALPHA: make sector size dynamic in extlinux
...ode, opt.raid_mode, opt.directory, NULL, SECTOR_SIZE); patch_sectors = (i + SECTOR_SIZE - 1) >> SECTOR_SHIFT; /* diff --git a/extlinux/main.c b/extlinux/main.c index f0d8e11..e40b4d7 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -95,6 +95,18 @@ static uint64_t get_size(int devfd) } /* + * Get sector size + */ +static unsigned get_sector_size(int devfd) +{ + int size; + + if (!ioctl(devfd, BLKSSZGET, &size)) + return size; + return SECTOR_SIZE; +} + +/* * Get device geometry and partition offset */ struct geometry_table { @@ -145,7 +157,7 @@ static con...
2012 Aug 02
0
[PATCH 2/3] ALPHA: first try to fix adv problem
...+++++++++++++++++++++++++++++++++++----- 1 files changed, 35 insertions(+), 5 deletions(-) diff --git a/extlinux/main.c b/extlinux/main.c index e40b4d7..61eaad1 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -275,7 +275,8 @@ static int patch_file_and_bootblock(int fd, const char *dir, int devfd) dprintf("subpath = %s\n", subpath); totalbytes = get_size(devfd); - sector_size = get_sector_size(devfd); + /* FIXME support greater sector sizes for BTRFS */ + sector_size = fs_type == BTRFS ? SECTOR_SIZE : get_sector_size(devfd); get_geometry(devfd, totalbytes...
2015 Sep 11
0
[PATCH v2 1/1] extlinux: fix memory leak
...; @@ -1350,10 +1361,10 @@ static const char *get_devname(const char > *path) return devname; > } > > -static int open_device(const char *path, struct stat *st, const char > **_devname) +static int open_device(const char *path, struct stat > *st, char **_devname) { > int devfd; > - const char *devname = NULL; > + char *devname = NULL; > struct statfs sfs; > > if (st) > @@ -1393,11 +1404,10 @@ static int open_device(const char *path, > struct stat *st, const char **_devname) > devfd = -1; > devname = get_devname(path...
2014 Dec 24
14
[PATCH 0/8] extlinux: support unmounted ext2/3/4 filesystem
Hello syslinux, Merry Christmas! These patches will make extlinux work with umounted ext2/3/4 filesystem, for example: $ extlinux -i /dev/sdXN or $ extlinux -i file_block Also it can work with something like: $ extlinux /dev/sdXN --reset-adv or $ extlinux file_block --reset-adv We don't use a new option (I planed to use "-d" but it is already in use), it will check whether the
2011 Jul 16
1
crash in extlinux/main
Hi, I found a bug in extlinux/main.c. Writing a bootloader on a file mounted via /dev/mapper in Lunix it crashed on me with a segment fault. The bug is here: if (!ioctl(devfd, HDIO_GETGEO, &geo)) { Since we are already called with geo as a pointer the & is wrong as the pointer itself will be overwritten. This works: int get_geometry(int devfd, uint64_t totalbytes, struct hd_geometry *geo) { struct floppy_struct fd_str; struct loop_info li; stru...
2015 Sep 09
0
[PATCH v1 1/1] extlinux: fix memory leak
...gram, path); return devname; @@ -1350,10 +1361,10 @@ static const char *get_devname(const char *path) return devname; } -static int open_device(const char *path, struct stat *st, const char **_devname) +static int open_device(const char *path, struct stat *st, char **_devname) { int devfd; - const char *devname = NULL; + char *devname = NULL; struct statfs sfs; if (st) @@ -1393,11 +1404,10 @@ static int open_device(const char *path, struct stat *st, const char **_devname) devfd = -1; devname = get_devname(path); - if (_devname) - *_devname = devname;...
2012 Sep 10
19
Initial support for sector size >512
This set of patches add some support for sector size >512. Currently it fixes extlinux, MBR for GPT and ext partitions. Other code is unaffected. This set of patches has been tested on a read Dell machine running a beta firmware.
2013 Jul 12
2
[PATCH 001/001] Add UFS1/2 support to Extlinux installer.
...boot image, the boot sector is from 0~512, the boot image starts after + */ #define BTRFS_BOOTSECT_AREA 65536 #define BTRFS_EXTLINUX_OFFSET SECTOR_SIZE #define BTRFS_SUBVOL_MAX 256 /* By btrfs specification */ @@ -308,12 +312,12 @@ static int patch_file_and_bootblock(int fd, const char *dir, int devfd) nsect += 2; /* Two sectors for the ADV */ sectp = alloca(sizeof(sector_t) * nsect); if (fs_type == EXT2 || fs_type == VFAT || fs_type == NTFS || - fs_type == XFS) { + fs_type == XFS || fs_type == UFS1) { if (sectmap(fd, sectp, nsect)) { perror("bmap"); exit(1);...
2011 Apr 15
0
[GIT PULL] syslinux command-line
...nstaller/syslxcom.h | 1 + linux/syslinux.c | 4 ++++ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/extlinux/main.c b/extlinux/main.c index 21369e4..e5212a9 100755 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -503,19 +503,6 @@ int install_file(const char *path, int devfd, struct stat *rst) return 1; } -/* - * SYSLINUX installs the string 'SYSLINUX' at offset 3 in the boot - * sector; this is consistent with FAT filesystems. Earlier versions - * would install the string "EXTLINUX" instead, handle both. - */ -int already_installed(int devfd) -{...
2015 Nov 13
0
[PATCH 2/4] extlinux: rename ext2_fat_install_file
...d, 2 insertions(+), 2 deletions(-) diff --git a/extlinux/main.c b/extlinux/main.c index 5bab712..c446c75 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -595,7 +595,7 @@ static int ext_install_ldlinux_c32(const char *path) return rv; } -int ext2_fat_install_file(const char *path, int devfd, struct stat *rst) +int ext_common_install_file(const char *path, int devfd, struct stat *rst) { char *file, *oldfile; int fd = -1, dirfd = -1; @@ -1007,7 +1007,7 @@ static int install_file(const char *path, int devfd, struct stat *rst) { if (fs_type == EXT2 || fs_type == VFAT || f...
2013 Jul 19
0
[PATCH 001/001] Add UFS1/2 support to Extlinux installer.
...; +/* btrfs/ufs2 has to install the ldlinux.sys in the first 64K blank area, which > is not managered by btrfs tree, so actually this is not installed as files. > since the cow feature of btrfs will move the ldlinux.sys every where */ > int btrfs_install_file(const char *path, int devfd, struct stat *rst) The ufs2 portion of this could do with more explanation, since the btrfs reasons don't apply to ufs2, right (ufs2 has no cow feature)? > @@ -955,9 +974,10 @@ static char * get_default_subvol(char * rootdir, char * subvol) > > static int install_file(const char *...