X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffb-param.c;h=0180f62b4a66e3a938b8ea86ce81eae8c43e7715;hb=ec085c955731db594926666e9bc6bdbbc1f5be9e;hp=e487ced4068bb9e01fb26792ad820a84c28abf5b;hpb=87b27e3e532a51e97407cd6f54533138d78ebd01;p=libucw.git diff --git a/lib/fb-param.c b/lib/fb-param.c index e487ced4..0180f62b 100644 --- a/lib/fb-param.c +++ b/lib/fb-param.c @@ -25,7 +25,7 @@ struct cf_section fbpar_cf = { # define F(x) PTR_TO(struct fb_params, x) CF_TYPE(struct fb_params), CF_ITEMS { - CF_LOOKUP("Type", (int *)F(type), ((byte *[]){"std", "direct", "mmap", NULL})), + CF_LOOKUP("Type", (int *)F(type), ((char *[]){"std", "direct", "mmap", NULL})), CF_UNS("BufSize", F(buffer_size)), CF_UNS("KeepBackBuf", F(keep_back_buf)), CF_UNS("ReadAhead", F(read_ahead)), @@ -49,11 +49,14 @@ fbpar_global_init(void) } static struct fastbuf * -bopen_fd_internal(int fd, struct fb_params *params, uns mode, byte *name) +bopen_fd_internal(int fd, struct fb_params *params, uns mode, const byte *name) { byte buf[32]; if (!name) - sprintf(name = buf, "fd%d", fd); + { + sprintf(buf, "fd%d", fd); + name = buf; + } struct fastbuf *fb; switch (params->type) { @@ -69,7 +72,7 @@ bopen_fd_internal(int fd, struct fb_params *params, uns mode, byte *name) params->read_ahead ? : fbpar_def.read_ahead, params->write_back ? : fbpar_def.write_back); if (!~mode && !fbdir_cheat && ((int)(mode = fcntl(fd, F_GETFL)) < 0 || fcntl(fd, F_SETFL, mode | O_DIRECT)) < 0) - log(L_WARN, "Cannot set O_DIRECT on fd %d: %m", fd); + msg(L_WARN, "Cannot set O_DIRECT on fd %d: %m", fd); return fb; case FB_MMAP: if (!~mode && (int)(mode = fcntl(fd, F_GETFL)) < 0) @@ -81,7 +84,7 @@ bopen_fd_internal(int fd, struct fb_params *params, uns mode, byte *name) } static struct fastbuf * -bopen_file_internal(byte *name, int mode, struct fb_params *params, int try) +bopen_file_internal(const byte *name, int mode, struct fb_params *params, int try) { if (params->type == FB_DIRECT && !fbdir_cheat) mode |= O_DIRECT; @@ -101,13 +104,13 @@ bopen_file_internal(byte *name, int mode, struct fb_params *params, int try) } struct fastbuf * -bopen_file(byte *name, int mode, struct fb_params *params) +bopen_file(const char *name, int mode, struct fb_params *params) { return bopen_file_internal(name, mode, params ? : &fbpar_def, 0); } struct fastbuf * -bopen_file_try(byte *name, int mode, struct fb_params *params) +bopen_file_try(const char *name, int mode, struct fb_params *params) { return bopen_file_internal(name, mode, params ? : &fbpar_def, 1); }