Lines Matching full:rs

54 			struct inode *inode, struct rock_state *rs)  in setup_rock_ridge()  argument
56 rs->len = sizeof(struct iso_directory_record) + de->name_len[0]; in setup_rock_ridge()
57 if (rs->len & 1) in setup_rock_ridge()
58 (rs->len)++; in setup_rock_ridge()
59 rs->chr = (unsigned char *)de + rs->len; in setup_rock_ridge()
60 rs->len = *((unsigned char *)de) - rs->len; in setup_rock_ridge()
61 if (rs->len < 0) in setup_rock_ridge()
62 rs->len = 0; in setup_rock_ridge()
65 rs->len -= ISOFS_SB(inode->i_sb)->s_rock_offset; in setup_rock_ridge()
66 rs->chr += ISOFS_SB(inode->i_sb)->s_rock_offset; in setup_rock_ridge()
67 if (rs->len < 0) in setup_rock_ridge()
68 rs->len = 0; in setup_rock_ridge()
72 static void init_rock_state(struct rock_state *rs, struct inode *inode) in init_rock_state() argument
74 memset(rs, 0, sizeof(*rs)); in init_rock_state()
75 rs->inode = inode; in init_rock_state()
85 static int rock_continue(struct rock_state *rs) in rock_continue() argument
88 int blocksize = 1 << rs->inode->i_blkbits; in rock_continue()
91 kfree(rs->buffer); in rock_continue()
92 rs->buffer = NULL; in rock_continue()
94 if ((unsigned)rs->cont_offset > blocksize - min_de_size || in rock_continue()
95 (unsigned)rs->cont_size > blocksize || in rock_continue()
96 (unsigned)(rs->cont_offset + rs->cont_size) > blocksize) { in rock_continue()
99 rs->cont_extent, rs->cont_offset, rs->cont_size); in rock_continue()
104 if (rs->cont_extent) { in rock_continue()
107 rs->buffer = kmalloc(rs->cont_size, GFP_KERNEL); in rock_continue()
108 if (!rs->buffer) { in rock_continue()
113 if (++rs->cont_loops >= RR_MAX_CE_ENTRIES) in rock_continue()
115 bh = sb_bread(rs->inode->i_sb, rs->cont_extent); in rock_continue()
117 memcpy(rs->buffer, bh->b_data + rs->cont_offset, in rock_continue()
118 rs->cont_size); in rock_continue()
120 rs->chr = rs->buffer; in rock_continue()
121 rs->len = rs->cont_size; in rock_continue()
122 rs->cont_extent = 0; in rock_continue()
123 rs->cont_size = 0; in rock_continue()
124 rs->cont_offset = 0; in rock_continue()
130 kfree(rs->buffer); in rock_continue()
131 rs->buffer = NULL; in rock_continue()
136 * We think there's a record of type `sig' at rs->chr. Parse the signature
139 static int rock_check_overflow(struct rock_state *rs, int sig) in rock_check_overflow() argument
185 if (len > rs->len) { in rock_check_overflow()
189 sig, len, rs->len); in rock_check_overflow()
201 struct rock_state rs; in get_rock_ridge_filename() local
214 init_rock_state(&rs, inode); in get_rock_ridge_filename()
215 setup_rock_ridge(de, inode, &rs); in get_rock_ridge_filename()
218 while (rs.len > 2) { /* There may be one byte for padding somewhere */ in get_rock_ridge_filename()
219 rr = (struct rock_ridge *)rs.chr; in get_rock_ridge_filename()
227 sig = isonum_721(rs.chr); in get_rock_ridge_filename()
228 if (rock_check_overflow(&rs, sig)) in get_rock_ridge_filename()
230 rs.chr += rr->len; in get_rock_ridge_filename()
231 rs.len -= rr->len; in get_rock_ridge_filename()
236 if (rs.len < 0) in get_rock_ridge_filename()
249 rs.cont_extent = isonum_733(rr->u.CE.extent); in get_rock_ridge_filename()
250 rs.cont_offset = isonum_733(rr->u.CE.offset); in get_rock_ridge_filename()
251 rs.cont_size = isonum_733(rr->u.CE.size); in get_rock_ridge_filename()
286 kfree(rs.buffer); in get_rock_ridge_filename()
292 ret = rock_continue(&rs); in get_rock_ridge_filename()
298 kfree(rs.buffer); in get_rock_ridge_filename()
318 struct rock_state rs; in parse_rock_ridge_inode_internal() local
324 init_rock_state(&rs, inode); in parse_rock_ridge_inode_internal()
325 setup_rock_ridge(de, inode, &rs); in parse_rock_ridge_inode_internal()
327 rs.chr += 14; in parse_rock_ridge_inode_internal()
328 rs.len -= 14; in parse_rock_ridge_inode_internal()
329 if (rs.len < 0) in parse_rock_ridge_inode_internal()
330 rs.len = 0; in parse_rock_ridge_inode_internal()
334 while (rs.len > 2) { /* There may be one byte for padding somewhere */ in parse_rock_ridge_inode_internal()
335 rr = (struct rock_ridge *)rs.chr; in parse_rock_ridge_inode_internal()
343 sig = isonum_721(rs.chr); in parse_rock_ridge_inode_internal()
344 if (rock_check_overflow(&rs, sig)) in parse_rock_ridge_inode_internal()
346 rs.chr += rr->len; in parse_rock_ridge_inode_internal()
347 rs.len -= rr->len; in parse_rock_ridge_inode_internal()
352 if (rs.len < 0) in parse_rock_ridge_inode_internal()
368 rs.cont_extent = isonum_733(rr->u.CE.extent); in parse_rock_ridge_inode_internal()
369 rs.cont_offset = isonum_733(rr->u.CE.offset); in parse_rock_ridge_inode_internal()
370 rs.cont_size = isonum_733(rr->u.CE.size); in parse_rock_ridge_inode_internal()
586 ret = rock_continue(&rs); in parse_rock_ridge_inode_internal()
592 kfree(rs.buffer); in parse_rock_ridge_inode_internal()
703 struct rock_state rs; in rock_ridge_symlink_read_folio() local
709 init_rock_state(&rs, inode); in rock_ridge_symlink_read_folio()
731 setup_rock_ridge(raw_de, inode, &rs); in rock_ridge_symlink_read_folio()
734 while (rs.len > 2) { /* There may be one byte for padding somewhere */ in rock_ridge_symlink_read_folio()
735 rr = (struct rock_ridge *)rs.chr; in rock_ridge_symlink_read_folio()
738 sig = isonum_721(rs.chr); in rock_ridge_symlink_read_folio()
739 if (rock_check_overflow(&rs, sig)) in rock_ridge_symlink_read_folio()
741 rs.chr += rr->len; in rock_ridge_symlink_read_folio()
742 rs.len -= rr->len; in rock_ridge_symlink_read_folio()
743 if (rs.len < 0) in rock_ridge_symlink_read_folio()
763 rs.cont_extent = isonum_733(rr->u.CE.extent); in rock_ridge_symlink_read_folio()
764 rs.cont_offset = isonum_733(rr->u.CE.offset); in rock_ridge_symlink_read_folio()
765 rs.cont_size = isonum_733(rr->u.CE.size); in rock_ridge_symlink_read_folio()
771 ret = rock_continue(&rs); in rock_ridge_symlink_read_folio()
788 kfree(rs.buffer); in rock_ridge_symlink_read_folio()