Changes by: szaka
Update of /cvsroot/linux-ntfs/linux-ntfs/libntfs
In directory usw-pr-cvs1:/tmp/cvs-serv21283/libntfs
Modified Files:
attrib.c
Log Message:
Remove obsolote/unused set_attribute_value()
Index: attrib.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/libntfs/attrib.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -U2 -r1.62 -r1.63
--- attrib.c 14 Jul 2002 17:21:32 -0000 1.62
+++ attrib.c 14 Jul 2002 17:24:58 -0000 1.63
@@ -224,105 +224,4 @@
}
-/**
- * set_attribute_value
- */
-int set_attribute_value(ntfs_volume *vol, ATTR_RECORD *a,
- const u8 *b, s64 l)
-{
- /* Sanity check. */
- if (!vol || !a || !b) {
- errno = EINVAL;
- return 0;
- }
- /* FIXME: We can't deal with changes in attribute value length at the
- moment. */
- if ((l != get_attribute_value_length(a)) || !l) {
- errno = ENOTSUP;
- return 0;
- }
- /* Complex attribute? */
- if (a->flags) {
- puts("Enountered non-zero attribute flags. Cannot handle this "
- "yet.");
- errno = ENOTSUP;
- return 0;
- }
- if (!a->non_resident) { /* Attribute is resident. */
- /* Sanity check. */
- if (le32_to_cpu(a->value_length) +
- le16_to_cpu(a->value_offset) > le32_to_cpu(a->length)) {
- errno = EINVAL;
- return 0;
- }
- memcpy((char*)a + le16_to_cpu(a->value_offset), b, l);
- errno = 0;
- return 1;
- } else { /* Attribute is not resident. */
- run_list *rl;
- s64 total, w;
- int i;
-
- /* If no data return 1. FIXME: This needs to change when we can
- cope with changes in length of the attribute. */
- if (!(a->data_size)) {
- errno = 0;
- return 1;
- }
- /* Decompress the mapping pairs array into a run list. */
- rl = ntfs_decompress_mapping_pairs(vol, a, NULL);
- if (!rl) {
- errno = EINVAL;
- return 0;
- }
- /* Now write all clusters to disk from b. */
- for (i = 0, total = 0; rl[i].length && (l > 0); i++) {
- w = ntfs_pwrite(vol->fd, rl[i].lcn <<
- vol->cluster_size_bits, min(l,
- rl[i].length << vol->cluster_size_bits),
- b + total);
- if (w != min(l, rl[i].length <<
- vol->cluster_size_bits)) {
-#define ESTR "Error writing attribute value"
- if (w == -1) {
- int eo = errno;
- perror(ESTR);
- errno = eo;
- } else if (w < min(l, rl[i].length <<
- vol->cluster_size_bits)) {
- fprintf(stderr, ESTR ": Ran out of "
- "input data.\n");
- errno = EIO;
- } else {
- fprintf(stderr, ESTR ": unknown "
- "error\n");
- errno = EIO;
- }
-#undef ESTR
- return 0;
- }
- total += w;
- l -= w;
- if ((l <= 0) && rl[i+1].length) {
- fprintf(stderr,
- "Warning: Amount of data to write "
- "doesn't match attribute length in\n"
- "run list! - The old data that was "
- "present beyond the new data written\n"
- "has been preserved.\n");
- } else if ((l > 0) && !rl[i+1].length) {
- fprintf(stderr,
- "Warning: Still have data to write but "
- "the attribute length in the run list\n"
- "was exceeded! - Data written has been "
- "truncated!\n");
- }
- }
- free(rl);
- return 1;
- }
- errno = EINVAL;
- return 0;
-}
-
/* Already cleaned up code below, but still look for FIXME:... */
|