|
From: Ben O. <ben...@us...> - 2002-02-26 02:20:08
|
Update of /cvsroot/njbfs/njbfs
In directory usw-pr-cvs1:/tmp/cvs-serv32132
Modified Files:
Tag: ben
njbfs_cache.c njbfs_cache.h njbfs_dir.c proc.c
Log Message:
ben: memory issue changes from head of branch
Index: njbfs_cache.c
===================================================================
RCS file: /cvsroot/njbfs/njbfs/njbfs_cache.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** njbfs_cache.c 24 Feb 2002 11:33:58 -0000 1.1.2.1
--- njbfs_cache.c 26 Feb 2002 02:20:05 -0000 1.1.2.2
***************
*** 552,561 ****
while(fattr_list) {
fattr = fattr_list->fattr;
- kfree(fattr->fname);
- kfree(fattr->codec);
- kfree(fattr->title);
- kfree(fattr->artist);
- kfree(fattr->album);
- kfree(fattr->genre);
track_destroy(fattr->track);
--- 552,555 ----
***************
*** 724,738 ****
while (frame != NULL) {
if (!strcmp(FR_ARTIST, frame->label)) {
! SAFE_STRDUP_NULL(fattr->artist, (char *) frame->data);
} else if (!strcmp(FR_FNAME, frame->label)) {
! SAFE_STRDUP_NULL(fattr->fname, (char *) frame->data);
} else if (!strcmp(FR_TITLE, frame->label)) {
! SAFE_STRDUP_NULL(fattr->title, (char *) frame->data);
} else if (!strcmp(FR_CODEC, frame->label)) {
! SAFE_STRDUP_NULL(fattr->codec, (char *) frame->data);
} else if (!strcmp(FR_ALBUM, frame->label)) {
! SAFE_STRDUP_NULL(fattr->album, (char *) frame->data);
} else if (!strcmp(FR_GENRE, frame->label)) {
! SAFE_STRDUP_NULL(fattr->genre, (char *) frame->data);
} else if (!strcmp(FR_SIZE, frame->label)) {
fattr->size = get_track_size(frame);
--- 718,732 ----
while (frame != NULL) {
if (!strcmp(FR_ARTIST, frame->label)) {
! fattr->artist = frame->data;
} else if (!strcmp(FR_FNAME, frame->label)) {
! fattr->fname = frame->data;
} else if (!strcmp(FR_TITLE, frame->label)) {
! fattr->title = frame->data;
} else if (!strcmp(FR_CODEC, frame->label)) {
! fattr->codec = frame->data;
} else if (!strcmp(FR_ALBUM, frame->label)) {
! fattr->album = frame->data;
} else if (!strcmp(FR_GENRE, frame->label)) {
! fattr->genre = frame->data;
} else if (!strcmp(FR_SIZE, frame->label)) {
fattr->size = get_track_size(frame);
Index: njbfs_cache.h
===================================================================
RCS file: /cvsroot/njbfs/njbfs/njbfs_cache.h,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -C2 -d -r1.4.2.2 -r1.4.2.3
*** njbfs_cache.h 24 Feb 2002 11:33:58 -0000 1.4.2.2
--- njbfs_cache.h 26 Feb 2002 02:20:05 -0000 1.4.2.3
***************
*** 192,195 ****
--- 192,204 ----
};
+ struct njbfs_write_cache {
+ int fileid;
+ off_t offset;
+ void *page;
+ struct njbfs_write_cache *prev;
+ struct njbfs_write_cache *next;
+ };
+
+
struct njbfs_sb_info;
Index: njbfs_dir.c
===================================================================
RCS file: /cvsroot/njbfs/njbfs/njbfs_dir.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** njbfs_dir.c 24 Feb 2002 11:33:58 -0000 1.1.2.1
--- njbfs_dir.c 26 Feb 2002 02:20:05 -0000 1.1.2.2
***************
*** 177,180 ****
--- 177,185 ----
p->entry.atime = CURRENT_TIME;
+ kfree(album);
+ kfree(artist);
+ kfree(title);
+ kfree(codec);
+
return 0;
}
Index: proc.c
===================================================================
RCS file: /cvsroot/njbfs/njbfs/proc.c,v
retrieving revision 1.6.2.3
retrieving revision 1.6.2.4
diff -C2 -d -r1.6.2.3 -r1.6.2.4
*** proc.c 24 Feb 2002 11:33:58 -0000 1.6.2.3
--- proc.c 26 Feb 2002 02:20:05 -0000 1.6.2.4
***************
*** 428,520 ****
}
- int write_id3_frame(char *buf, char *id, char *val)
- {
- u_int32_t size;
- int i, count = 0;
-
- for (i = 0; i < 4; i++, count++) {
- buf[count] = id[i];
- }
- size = __cpu_to_be32((u_int32_t) strlen(val) + 1);
-
- memcpy((void *) buf + count, &size, 4);
- count += 4;
-
- /* defaults for frame header tag, zero */
- buf[count++] = 0x0;
- buf[count++] = 0x0;
-
- /* this signifies iso-whatever (standard) encoding */
- buf[count++] = 0x0;
-
- for (i = 0; val[i]; i++)
- buf[count++] = val[i];
-
- return count;
- }
-
- int write_id3_frame_numeric(char *buf, char *id, u_int32_t val)
- {
- static char vbuf[80];
- sprintf(vbuf, "%u", val);
- return write_id3_frame(buf, id, vbuf);
- }
-
- int create_id3_tag(struct dentry *dentry, char *buffer)
- {
- struct njbfs_fattr *fattr;
- char *p = buffer;
- struct njbfs_sb_info *info =
- (struct njbfs_sb_info *) dentry->d_inode->i_sb->u.generic_sbp;
- u_int32_t size = NJBFS_ID3SIZE - 10;
- /* our blocksize minus 10 for the tag header */
- int i;
-
- njbfs_read_lock(dentry->d_inode);
- fattr = njbfs_get_attr_nolock(dentry, info);
- if ( ! fattr )
- return -EINVAL;
- njbfs_read_unlock(dentry->d_inode);
-
- memset(buffer, 0, NJBFS_BLOCKSIZE);
-
- strcat(buffer, "ID3");
-
- /* set to version 2.3.0 */
- buffer[3] = 0x03;
- buffer[4] = 0x00;
-
- /* all id3 flags empty */
- buffer[5] = 0x00;
-
- /* id3 uses a 28 bit number for tag size. how odd. */
- for (i = 0; i <= 4; i++) {
- buffer[9 - i] = (char) size & 0x7F;
- size >>= 7;
- }
-
- p = buffer + 10;
- /* write da tags, biznatch */
- if ( fattr->artist )
- p += write_id3_frame(p, "TPE1", fattr->artist);
-
- if ( fattr->title )
- p += write_id3_frame(p, "TIT2", fattr->title);
-
- if ( fattr->album )
- p += write_id3_frame(p, "TALB", fattr->album);
-
- if ( fattr->genre )
- p += write_id3_frame(p, "TCON", fattr->genre);
-
- if ( fattr->tracknum )
- p += write_id3_frame_numeric(p, "TRCK", fattr->tracknum);
-
- if ( fattr->year )
- p += write_id3_frame_numeric(p, "TYER", fattr->year);
-
- return 0;
- }
-
/*
we pass this function into generic_file_read.
--- 428,431 ----
***************
*** 767,770 ****
--- 678,683 ----
return bytes + faked;
}
+
+
/**
|