1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

o Arbitrary mount path.

o Name length 128.
This commit is contained in:
Alasdair Kergon 2001-09-17 16:55:31 +00:00
parent d8d1435e15
commit 749e7c1bb4
2 changed files with 18 additions and 11 deletions

View File

@ -47,6 +47,9 @@ struct line_c {
static int is_identifier(const char *str, int len) static int is_identifier(const char *str, int len)
{ {
if (len > DM_NAME_LEN - 1)
return 0;
while(len--) { while(len--) {
if (!isalnum(*str) && *str != '_') if (!isalnum(*str) && *str != '_')
return 0; return 0;
@ -92,21 +95,25 @@ int extract_line(struct text_region *line, void *private)
static struct file *open_error_file(struct file *table) static struct file *open_error_file(struct file *table)
{ {
char *name;
struct file *f; struct file *f;
char *name, *buffer = (char *) kmalloc(PATH_MAX + 1, GFP_KERNEL);
name = kmalloc(PATH_MAX + 1, GFP_KERNEL); if (!buffer)
if (!name)
return 0; return 0;
/* FIXME: Assumes path depth; avoid filp_open. */ /* Get path name */
sprintf(name, "/%s/%s/%s.err", name = d_path(table->f_dentry, table->f_vfsmnt, buffer, PATH_MAX + 1);
table->f_vfsmnt->mnt_mountpoint->d_name.name,
table->f_dentry->d_parent->d_name.name, if (!name) {
table->f_dentry->d_name.name); kfree(buffer);
return 0;
}
/* Create error file */
strcat(name, ".err");
f = filp_open(name, O_WRONLY | O_TRUNC | O_CREAT, S_IRUGO); f = filp_open(name, O_WRONLY | O_TRUNC | O_CREAT, S_IRUGO);
kfree(name);
kfree(buffer);
if (f) if (f)
f->f_dentry->d_inode->u.generic_ip = NOT_A_TABLE; f->f_dentry->d_inode->u.generic_ip = NOT_A_TABLE;

View File

@ -137,7 +137,7 @@
#define NODE_SIZE L1_CACHE_BYTES #define NODE_SIZE L1_CACHE_BYTES
#define KEYS_PER_NODE (NODE_SIZE / sizeof(offset_t)) #define KEYS_PER_NODE (NODE_SIZE / sizeof(offset_t))
#define CHILDREN_PER_NODE (KEYS_PER_NODE + 1) #define CHILDREN_PER_NODE (KEYS_PER_NODE + 1)
#define DM_NAME_LEN 64 #define DM_NAME_LEN 128
#define MAX_TARGET_LINE 256 #define MAX_TARGET_LINE 256
enum { enum {