diff --git a/ChangeLog b/ChangeLog index c37d359a..ee87f32f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,9 +2,12 @@ xx/xx/2006 - x.xx.x - . - ntfsmount now creates files and directories with security descriptor that grant full access to everyone. (Yura) + - Fix typo that lead to incorrect sparse file size calculation. (Yuval) - Fix long standing stupendously stupid bug in libntfs/attrib.c:: ntfs_external_attr_find() and also port a bugfix from the advanced ntfs kernel driver to the same function. (Anton) + - Add new API ntfs_attr_exist() that checks whether attribute with + selected type and name already present in inode. (Szaka) 21/06/2006 - 1.13.1 - Various fixes. diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 27b3a833..a1502c99 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -317,6 +317,9 @@ extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na, VCN from_vcn); extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize); +extern int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type, + ntfschar *name, u32 name_len); + // FIXME / TODO: Above here the file is cleaned up. (AIA) /** * get_attribute_value_length - return the length of the value of an attribute diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9d5c2307..3e4f83c2 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3,6 +3,7 @@ * * Copyright (c) 2000-2006 Anton Altaparmakov * Copyright (c) 2002-2005 Richard Russon + * Copyright (c) 2002-2006 Szabolcs Szakacsits * Copyright (c) 2004-2006 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -5057,3 +5058,24 @@ out: return ret; } +/** + * ntfs_attr_exist - FIXME: description + */ +int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type, ntfschar *name, + u32 name_len) +{ + ntfs_attr_search_ctx *ctx; + int ret; + + ntfs_log_trace("Entering.\n"); + + ctx = ntfs_attr_get_search_ctx(ni, NULL); + if (!ctx) + return 0; + + ret = ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, 0, NULL, 0, + ctx); + + ntfs_attr_put_search_ctx(ctx); + return !ret; +}